<template>
  <div>
    <div class="mHead">
      <el-image :src="vals" class="image" width="100%" height="100%" />
    </div>
    <div
      style="
        width: 350px;
        height: 50px;
        margin-left: 10px;
        margin-top: 40px;
        display: flex;
        float: left;
      "
    >
      <span style="font-size: xx-large; color: white; font-family: 'Arial Black'">{{
        movie.mname
      }}</span>
    </div>
    <div
      style="
        width: 450px;
        height: 40px;
        margin-left: -350px;
        margin-top: 100px;
        display: flex;
        float: left;
      "
    >
      <span style="font-size: large; color: white; font-family: 'Arial Black'">{{
        movie.nickname
      }}</span>
    </div>
    <div
      style="
        width: 450px;
        height: 40px;
        margin-left: -450px;
        margin-top: 140px;
        display: flex;
        float: left;
      "
    >
      <el-tag type="warning" style="margin-left: 30px">{{ movie.mlanguage }}</el-tag>
      <el-tag type="warning" style="margin-left: 30px">{{ movie.mtype }}</el-tag>
      <el-tag type="warning" style="margin-left: 30px">{{ movie.duration }}分钟</el-tag>
    </div>
    <div
      style="
        width: 450px;
        height: 40px;
        margin-left: -450px;
        margin-top: 180px;
        display: flex;
        float: left;
      "
    >
      <span style="font-size: large; color: white; font-family: 'Arial Black'"
        >导演：{{ movie.director }}</span
      >
    </div>
    <div
      style="
        width: 450px;
        height: 40px;
        margin-left: -450px;
        margin-top: 220px;
        display: flex;
        float: left;
      "
    >
      <span style="font-size: large; color: white; font-family: 'Arial Black'"
        >主演：{{ movie.mrole }}</span
      >
    </div>
  </div>
</template>
<script setup>
import axios from 'axios';
import { ElMessage } from 'element-plus';
import { ref, onMounted } from 'vue';
import emmitter from '../../utils/bus';
const movie = ref('');
const vals = ref();
onMounted(() => {
  const movieName = JSON.parse(sessionStorage.getItem('movieInfo'));
  axios.get('/api/movie/getMovieByMname/' + movieName).then(res => {
    if (res.data !== null) {
      movie.value = res.data[0];
      vals.value = require('../../assets/' + res.data[0].pic);
      emmitter.emit('movieEvent', movie.value);
    } else {
      ElMessage({
        showClose: true,
        message: '网络错误！',
        type: 'error',
      });
    }
  });
});
</script>
<style lang="scss" scoped>
.mHead {
  width: 250px;
  height: 350px;
  margin-left: 100px;
  margin-top: 40px;
  display: flex;
  float: left;
}
</style>
